import {req_get, req_get_auth, req_post_auth} from "./baseApi.js";
import {HOST} from './hosts'


export const getSCarRequests = (params) => {
    if (params === undefined)
        params = {}
    params.status = "S";
    const url = `${HOST}/carRequest/page`;
    return req_get_auth('get', url, params);
};
export const getAllCarRequests = (params) => {
    const url = `${HOST}/carRequest/page`;
    return req_get_auth('get', url, params);
};
export const listFreeCars = (data) => {
    const url = `${HOST}/cars/free-cars`
    return req_get_auth("get", url, data)
}
export const agreeCarRequest = (data) => {
    const url = `${HOST}/carRequest/agree`
    return req_post_auth("put", url, data);
};

export const rejectCarRequest = (data) => {
    const url = `${HOST}/carRequest/reject`
    return req_post_auth("put", url, data);
};
export const getFullCarRequest = (params) => {
    const url = `${HOST}/carRequest/report-detail`
    return req_get_auth("get", url, params);
};
// 用户
export const listCarRequests = (params) => {
    const url = `${HOST}/carRequest/list-car-requests`
    return req_get_auth("get", url, params);
};
// 司机
export const listCarRequestsDriver = (params) => {
    const url = `${HOST}/carRequest/list-car-driver`
    return req_get_auth("get", url, params);
};

export const getCurrentCarRequest = (params) => {
    const url = `${HOST}/carRequest/current_car-request`
    return req_get_auth("get", url, params);
};

export const applyCar = (data) => {
    const url = `${HOST}/carRequest/apply`
    return req_post_auth("post", url, data);
};

export const endCar = (data) => {
    const url = `${HOST}/carRequest/end`
    return req_post_auth("put", url, data);
};
export const addTrip = (data) => {
    const url = `${HOST}/trip/create`
    return req_post_auth("post", url, data);
};